<?php
/**
 * Created by PhpStorm.
 * User: coolinmind
 * Date: 25/01/2019
 * Time: 16:56
 */

namespace App\Modules\UCenter;


use App\Services\UCenter\UCenterIndex;

class Order extends BaseUcenter
{
    /**
     * 生成订单
     * @return array
     */
    public function createOrder()
    {
        $userInfo = $this->isLogin();
        if ($userInfo['status'] !== SUCCESS_STATUS) {
            return need_login($userInfo,'请登录');
        }
        $data = $this->postData;
        $data['user_id'] = $userInfo['res']['id'];
        return UCenterIndex::Order()->createOrder($data);
    }

    /**
     * 获取订单列表
     * @return array
     */
    public function getOrderList()
    {
        $userInfo = $this->isLogin();
        if ($userInfo['status'] !== SUCCESS_STATUS) {
            return need_login($userInfo,'请登录');
        }
        $data = $this->postData;
        $data['user_id'] = $userInfo['res']['id'];
        return UCenterIndex::Order()->getOrderList($data);
    }
}
